#ifndef __PLATFORM_OPLATFORM_WORLD_H__
#define __PLATFORM_OPLATFORM_WORLD_H__
#include "physics/oWorld.h"

namespace platform
{
	class oCamera;

	class oDLL oLayer: public CCNode
	{
	public:
		CCPoint ratio;
		void setOffset(const CCPoint& offset);
		const CCPoint& getOffset() const;
		virtual CCAffineTransform nodeToParentTransform();
		static oLayer* node();
	private:
		CCPoint _offset;
	};

	typedef unordered_map<int, oLayer*> oLayerMap;
	class oDLL oPlatformWorld: public oWorld
	{
	public:
		virtual bool init();
		virtual ~oPlatformWorld();
		PROPERTY_READONLY(oCamera*, Camera);
		PROPERTY_READONLY(CCNode*, UILayer);
		virtual void addChild(CCNode * child);
		virtual void addChild(CCNode * child, int zOrder);
		virtual void addChild(CCNode * child, int zOrder, int tag);
		oLayer* getLayer(int zOrder);
		void clearLayer(int zOrder);
		void clearLayer();
		void setLayerRatio(int zOrder, const CCPoint& ratio);
		const CCPoint& getLayerRatio(int zOrder);
		void setLayerOffset(int zOrder, const CCPoint& offset);
		const CCPoint& getLayerOffset(int zOrder);
		void onCameraMoved(float deltaX, float deltaY);
		LAYER_NODE_FUNC(oPlatformWorld);
	protected:
		oPlatformWorld();
	private:
		oCamera* _camera;
		CCNode* _layerUI;
		oLayerMap _layers;
	};
}

#endif